package com.hui.platform.falseworkapi.service.business.webmagic.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * Webmagic-webmagic爬虫 Swagger2接口文档配置
 *
 * @author hui
 * @since 2020-04-19
 */
@Configuration
public class WebmagicSwaggerConfig {

	/**
     *包接口位置
     */
	private static final String INTERFACE_PACKAGE="com.hui.platform.falseworkapi.service.business.webmagic.controller";

	@Bean
	public Docket webmagicApi() {
		return new Docket(DocumentationType.SWAGGER_2)
				.groupName("Webmagic-webmagic爬虫-接口集")
				.apiInfo(apiInfo())
				.select()
				.apis(RequestHandlerSelectors.basePackage(INTERFACE_PACKAGE))
				.paths(PathSelectors.any())
				.build();
	}

	private ApiInfo apiInfo() {
		return new ApiInfoBuilder()
				.title("MKTail的api文档-Webmagic-webmagic爬虫")
				.description("MKTail接口文档详细信息-webmagic爬虫")
				.termsOfServiceUrl("")
				.version("1.0")
				.build();
	}

}
